using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using Mehat.San.MediaChanger;

namespace Mehat.San.SanFS
{
	public class MediaChangerVirtualMount : DeviceVirtualMount
	{
		private MediaChanger.MediaChanger	mChanger;

		public MediaChangerVirtualMount()
		: base()
		{
		}
		
		public MediaChangerVirtualMount(XmlNode XmlConfig)
			: base(XmlConfig)
		{
			throw new Exception("fix");
		//	mChanger = new MediaChanger.MediaChanger(XmlConfig.FirstChild);
			
			//if (mChanger.InventoryStale)
				//mChanger.UpdateInventory();
		}
		
		public override IVirtualMount CreateInstance(XmlNode XmlConfig)
		{
			return new MediaChangerVirtualMount(XmlConfig);
		}

		protected override void Attach(IDirectory InternalRoot)
		{
			// TODO: Impliment
			throw new NotImplementedException();
		}
		
		public override void OpenFile(FileHandle Fh)
		{
			// TODO: If we're opening for read and disc is not mounted then schedule disc change
			// TODO: If we're opening for append then return error (not yet supported)
			// TODO: If we're opening for exclusive create then call down to the Disc Imager
			throw new NotImplementedException();
		}
		
		public override void FlushFile(FileHandle Fh)
		{
			throw new NotImplementedException();
		}
		
		public override void ReleaseFile(FileHandle Fh)
		{
			throw new NotImplementedException();
		}
		
		public override long ReadFile(FileHandle Fh, byte []Buffer, long Offset)
		{
			// TODO: If disc not mounted then schedule disc change
			throw new NotImplementedException();
		}
	}  // END CLASS
}	// END NAMESPACE
